<?php

class cronControllerBase extends controllerBase {
	public $mode = AETHER_CLI;
	public $view = false;
	
	public $storageSweeping = array(
		'minute' => 30,
		'hour' => '1',
		'dayOfMonth' => '*',
		'month' => '*',
		'dayOfWeek' => '*'
	);

	function storageSweeping() {
		echo 'Deleting expired storage entries... ';
		$this->m->load('storage');
		$this->m->storage->delete('all', array(
			'where' => new predicate('expires', '<', time())
		));
		echo 'Done.';
	}

	public $slSweeping = array(
		'minute' => 30,
		'hour' => 1,
		'dayOfMonth' => '*',
		'month' => '*',
		'dayOfWeek' => '*'
	);

	function slSweeping() {
		echo 'Deleting expired SL entries... ';
		$tables = $this->getParam('args');
		$tables = $tables['t'];
		foreach($tables as $table) {
			$this->m->load($table);
			$this->m->$table->delete('all', array(
				'where' => new predicate('time', '<', time()-24*60*60)
			));
		}
		echo 'Done.';
	}
}

